"""idcard added

Revision ID: 7b150a6ce60f
Revises: 8502fc18515a
Create Date: 2025-10-28 23:08:24.400059

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '7b150a6ce60f'
down_revision: Union[str, Sequence[str], None] = '8502fc18515a'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tb_id_card',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('card_number', sa.String(length=18), nullable=False),
    sa.Column('origin', sa.String(length=50), nullable=True),
    sa.Column('student_id', sa.Integer(), nullable=True),
    sa.Column('create_time', sa.DateTime(), nullable=False, comment='记录的创建时间'),
    sa.Column('update_time', sa.DateTime(), nullable=False, comment='记录最后一次修改的时间'),
    sa.ForeignKeyConstraint(['student_id'], ['tb_students.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('card_number')
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('tb_id_card')
    # ### end Alembic commands ###
